<!--
 * @description 动态接口
 * @author dumeng
 * @date 2022/10/19
 -->
<template>
  <div class="dynamic-data-page">
    <v-form v-show="show" :id="option.id" ref="dynamicForm" :fields="option.fields" @change="change" />
  </div>
</template>

<script>
import VForm from '@/components/CustomPage/form/index.vue'
import mixins from './../mixins'
import { deepClone, randomString } from '@/utils'
export default {
  name: 'VDynamicData',
  components: { VForm },
  mixins: [mixins],
  props: {
    option: {
      type: Object,
      default: {}
    }
  },
  data() {
    return {
      show: false
    }
  },
  created() {
    // this.on_event('radio-value-change', (e) => {
    //   if (e.data.target.option.name === 'dataorigin') {
    //     this.show = e.data.target.getValue() === '2'
    //   }
    // })
  },
  mounted() {
    this.setValue(this.value)
  },
  methods: {
    change() {
      this.dispatch_event('filed-value-change', '')
    },
    getValue() {
      if (this.$refs.dynamicForm) {
        return this.$refs.dynamicForm.getValue()
      }
    },
    setValue(data = {}) {
      if (this.$refs.dynamicForm) {
        return this.$refs.dynamicForm.setValue(data)
      }
    }
  }

}
</script>

<style scoped lang="scss">

</style>
